import request from '@/utils/request'

export function add(data) {
  return request({
    url: 'api/canteenManage',
    method: 'post',
    data
  })
}

export function del(ids) {
  return request({
    url: 'api/canteenManage/',
    method: 'delete',
    data: ids
  })
}

export function edit(data) {
  return request({
    url: 'api/canteenManage',
    method: 'put',
    data
  })
}

export function getCanteenPriceList() {
  return request({
    url: 'api/canteenManage/pricePage?current=1&size=100',
    method: 'get'
  })
}

export function getCanteenDiscountList() {
  return request({
    url: 'api/canteenManage/discountPage?current=1&size=100',
    method: 'get'
  })
}

export function priceSaveOrUpdate(data) {
  return request({
    url: 'api/canteenManage/priceSaveOrUpdate',
    method: 'post',
    data
  })
}

export function discountSaveOrUpdate(data) {
  return request({
    url: 'api/canteenManage/discountSaveOrUpdate',
    method: 'post',
    data
  })
}

export function deletePrice(ids) {
  return request({
    url: 'api/canteenManage/deletePrice',
    method: 'delete',
    data: ids
  })
}

export function deleteDiscount(ids) {
  return request({
    url: 'api/canteenManage/deleteDiscount',
    method: 'delete',
    data: ids
  })
}

export default { add, edit, del, getCanteenPriceList, priceSaveOrUpdate, deletePrice, getCanteenDiscountList, discountSaveOrUpdate, deleteDiscount }
